package com.yuexun.beilunpatient.ui.family.model.impl;

import com.yuexun.beilunpatient.base.BaseEntity;
import com.yuexun.beilunpatient.ui.family.api.FamilyApi;
import com.yuexun.beilunpatient.ui.family.bean.KinsfolkBean;
import com.yuexun.beilunpatient.ui.family.model.IFamilyModel;
import com.yuexun.beilunpatient.utils.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by chenss on 2018/11/6.
 */
public class FamilyModel implements IFamilyModel {

    private FamilyApi api;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginModel.class);

    public FamilyApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(FamilyApi.class);
        }
    }

    @Override
    public Observable<BaseEntity<KinsfolkBean>> getAppoinmentFamilyNum(Map<String, String> praise) {
        api = ApiInstance();
        return api.getAppoinmentFamilyNum(praise);
    }

    @Override
    public Observable<BaseEntity<String>> modifyAppoinmentFamilyNum(Map<String, String> praise) {
        api = ApiInstance();
        return api.modifyAppoinmentFamilyNum(praise);
    }

    @Override
    public Observable<BaseEntity<String>> deletePatientRelative(Map<String, String> praise) {
        api = ApiInstance();
        return api.deletePatientRelative(praise);
    }
}
